#include "stack.h"
#include "queue.h"
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>

Stack<std::string> *history;

Stack<std::string> *tmp;

int resume();
int undo();


int resume() {
    //TODO
    //撤销上一步。你可以返回你喜欢的任意整数
    if(tmp==NULL)tmp = new Stack<std::string>();
    if(history==NULL)history = new Stack<std::string>();
    if(tmp->get_size()==0)return 1;
    Node<std::string> *t = tmp->pop();
    //t->print();
    history->push(t);
    return 0;
}

int undo() {
    //TODO
    //重做上一步。你可以返回你喜欢的任意整数
    if(history==NULL)history = new Stack<std::string>();
    if(tmp==NULL)tmp = new Stack<std::string>();
    if (history->get_size() == 0)return 1;
    Node<std::string> *t = history->pop();
    //t->print();
    tmp->push(t);
    return 0;
}
